using System;
using System.IO;
class FileOperations {
    static void Main() {
        // 删除文件示例
        string fileToDelete = "example.txt";
        try {
            File.Delete(fileToDelete);
            Console.WriteLine($"{fileToDelete} deleted successfully.");
        } catch (IOException e) {
            Console.WriteLine($"Error deleting {fileToDelete}: {e.Message}");
        }

        // 移动文件示例
        string sourceFile = "example.txt";
        string destinationFile = "new_directory/example.txt";
        try {
            File.Move(sourceFile, destinationFile);
            Console.WriteLine($"{sourceFile} moved to {destinationFile} successfully.");
        } catch (IOException e) {
            Console.WriteLine($"Error moving {sourceFile} to {destinationFile}: {e.Message}");
        }
        // 重命名文件示例
        string currentName = "example.txt";
        string newName = "renamed_example.txt";
        try {
            File.Move(currentName, newName);
            Console.WriteLine($"{currentName} renamed to {newName} successfully.");
        } catch (IOException e) {
            Console.WriteLine($"Error renaming {currentName} to {newName}: {e.Message}");
        }

    }
}
